{% extends "base.html" %}

{% block title %}Events{% endblock title %}

{% block event_li %}class="active"{% endblock event_li %}

{% block breadcrumb %}
  <li>
    <a href="/events">Events</a> <span class="divider">/</span>
  </li>
  {% block sub_breadcrumb %}
    {% if not event_code %}
      <li class="active">
        <a href="/events">Select event</a>
      </li>
    {% else %}
      <li>
        <a href="/events/{{event_code|cut:" "}}">{{event_type.name}}</a>
        <span class="divider">/</span>
      </li>
    {% endif %}

    {% if level %}
      <li>
        <a href="/events/{{event_code|cut:" "}}/{{level}}">{{level_name}}</a>
        <span class="divider">/</span>
      </li>
    {% else %}{% if event_code %}
      <li class="active">
        <a href="/events/{{event_code|cut:" "}}">Select level</a>
      </li>
    {% endif %}{% endif %}

    {% if age_group %}
      <li>
        <a href="/events/{{event_code|cut:" "}}/{{level}}/{{age_group}}">{{age_group_name}}</a>
        <span class="divider">/</span>
      </li>
    {% else %}{% if level %}
      <li class="active">
        <a href="/events/{{event_code|cut:" "}}/{{level}}">Select age grouop</a>
      </li>
    {% endif %}{% endif %}

    {% if gender %}
      <li class="active">
        <a href="/event/{{event_code|cut:" "}}/{{level}}{{gender}}{{age_group}}{{event_code}}">{{event.gender.name}}</a>
      </li>
    {% else %}{% if age_group %}
      <li class="active">
        <a href="/events/{{event_code|cut:" "}}/{{level}}/{{age_group}}">Select gender</a>
      </li>
    {% endif %}{% endif %}
  {% endblock sub_breadcrumb%}
  {% block right_breadcrumb %}
  {% endblock right_breadcrumb %}
{% endblock breadcrumb %}

{% block navi_full %}
<div class="span4">
  <ul class="nav nav-list">
  {% for event_type_iter, meta in events %}
    <li {% if event_type_iter == event_type %}class="active"{% endif %}>
      <a href="/events/{{event_type_iter.code}}">
      {{event_type_iter.name}}
      <span class="label">{{meta.num_competitors}}</span>
      </a>
    </li>
  {% endfor %}
  </ul>
</div>

  <!---
  {% for catagory, catagory_events in all_event_catagories %}
    <li class="nav-header" style="color: black;">{{catagory}}</li>
    {% for _event_code, event_name, event_type_iter, num_competitors in catagory_events %}
      <li {% if event_type_iter == event_type %}class="active"{% endif %}><a href="/events/{{event_type_iter.code}}">
          {{event_name}}
          <span class="label">{{num_competitors}}</span>
        </a></li>
    {% endfor %}
  {% endfor %}
</ul></div>
-->
{% endblock navi_full %}

{% block content_full %}
<div class="span3"><ul class="nav nav-list">
  <!--- List of levels -->
  {% for level, meta in levels %}
    <li {% if meta.is_active %}class="active"{% endif %}><a href="/events/{{event_code}}/{{level.code}}">
      {{level.name}}
      <span class="label">{{meta.num_competitors}}</span>
    </a></li>
  {% endfor %}
</ul></div>

<div class="span3"><ul class="nav nav-list">
  <!--- List of age groups -->
  {% for age_group, meta in age_groups %}
    <li {% if meta.is_active %}class="active"{% endif %}><a href="/events/{{event_code}}/{{level}}/{{age_group.code}}">
      {{age_group.name}}
      <span class="label">{{meta.num_competitors}}</span>
    </a></li>
  {% endfor %}
</ul></div>

<div class="span2"><ul class="nav nav-list">
  <!--- List of genders -->
  {% for gender, meta in genders %}
    <li {% if meta.is_active %}class="active"{% endif %}><a href="/event/{{level}}{{gender.code}}{{age_group}}{{event_code}}/">
      {{gender.name}}
      <span class="label">{{meta.num_competitors}}</span>
    </a></li>
  {% endfor %}
</ul></div>
{% endblock content_full %}